#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>

void inherit (int n, void *arg)
{
	printf ("n: %d\t  arg:%s\n", n, (char *)arg);
	return ;
}
void inherit1 (int n, void *arg)
{
	printf ("n: %d\t  arg:%s\n", n, (char *)arg);
	return ;
}

int main (void)
{
	//注册遗言函数
	on_exit(inherit, "beijing");
	on_exit(inherit1, "beijing");
	
#if 1
	//创建子进程
	pid_t pid = fork();
	if (-1 == pid) {
		perror ("fork()");
		return -1;
	}
	if (0 == pid) {
		//子进程
	} else {
		getchar ();
		printf ("I am parent!\n");
	}
#endif
	exit (-1);

}
